module CanCamel::Filters
  class AtTime < AtDay
    def catch_args
      %i(hours days wdays)
    end

    def validate!
      validates presence_of: {
        fields: %i(hours days wdays),
        any: true,
      }
    end

    def filter(hours: nil, days: nil, wdays: nil)
      return if hours && !hours.include?(Time.now.hour)
      super days: days, wdays: wdays
    end
  end
end
